package com.ruoyi.yljf.controller.AdminController;

import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.yljf.domain.dto.ImageDTO;
import com.ruoyi.yljf.domain.dto.RefreshUploadVideoDTO;
import com.ruoyi.yljf.domain.dto.VideoDTO;
import com.ruoyi.yljf.service.IAliFileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

/**
 * @ClassName  文件上传相关  AliFileController
 * @Description
 * @Author wangpan
 * @Date 2025/3/15 16:37
 * @Version 1.0
 **/
@RestController
@RequestMapping("/yljf/file")
public class AliFileController {

    @Autowired
    private IAliFileService aliFileService;

    //点播上传视频
    @RequestMapping("/upload/video")
    public AjaxResult uploadVideo(@RequestBody VideoDTO videoDTO) {
        return AjaxResult.success(aliFileService.uploadVideo(videoDTO));
    }

    //点播上传流视频
    @RequestMapping("/upload/videoFile")
    public AjaxResult videoFileUpload(@RequestParam("file") MultipartFile file) {
        return aliFileService.videoFileUpload(file);
    }

    //根据点播ID播放视频
    @RequestMapping("/upload/getPlayInfo")
    public AjaxResult getPlayInfo(@RequestBody RefreshUploadVideoDTO refreshUploadVideoDTO) {
        return aliFileService.getPlayInfo(refreshUploadVideoDTO);
    }

    //上传图片
    @PostMapping("/upload/batchUpload")
    public AjaxResult batchUpload(@RequestParam("files") MultipartFile[] files) {
        return aliFileService.batchUpload(files);
    }

}
